a11y: Make the Button labelled by its child label
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 4 Nov 2020 16:43:59 +0000 (16:43 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 4 Nov 2020 17:15:13 +0000 (17:15 +0000)
Establish the relation whenever we set the label widget.

gtk/gtkbutton.c

index 91023ce39e6e5a54a800f2457748a5eaadd33276..f964eb74953792af03c62abda8f58c22736bb21b 100644 (file)
@@ -938,6 +938,11 @@ gtk_button_set_icon_name (GtkButton  *button,
       gtk_image_set_from_icon_name (GTK_IMAGE (priv->child), icon_name);
     }
 
+  gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
+                                  GTK_ACCESSIBLE_RELATION_LABELLED_BY,
+                                    g_list_append (NULL, priv->child),
+                                  -1);
+
   gtk_button_set_child_type (button, ICON_CHILD);
   g_object_notify_by_pspec (G_OBJECT (button), props[PROP_ICON_NAME]);
 }